In [1]:
%matplotlib inline
import ocw
from functions import commonLatLonGrid
In [2]:
import ocw.data_source.local as local
path = "/Users/bdwilson/Documents/code/RCMES/Workshop/AFRICA_UC-WRF311_CTL_ERAINT_MM_50km-rg_1989-2008_tasmax.nc"
variable = "tasmax"
satellite_ds = local.load_file(path, variable)
print satellite_ds
In [3]:
path = "/Users/bdwilson/Documents/code/RCMES/Workshop/AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc"
variable = "tasmax"
model_ds = local.load_file(path, variable)
print model_ds
In [4]:
import ocw.dataset_processor as dsp
from datetime import timedelta
timeRes=timedelta(days=365)
satellite_ds = dsp.temporal_rebin(satellite_ds, timeRes)
model_ds = dsp.temporal_rebin(model_ds, timeRes)
print satellite_ds
print model_ds
In [5]:
latRes = 1.0 # degrees
lonRes = 1.0 # degrees
lats, lons = commonLatLonGrid([satellite_ds, model_ds], latRes, lonRes)
# Find common spatial bounds, return desired grid with specified resolution
satellite_ds = dsp.spatial_regrid(satellite_ds, lats, lons)
model_ds = dsp.spatial_regrid(model_ds, lats, lons)
In [6]:
import ocw.metrics as metrics
import ocw.evaluation as evaluation
metric = metrics.Bias()
eval = evaluation.Evaluation(satellite_ds, [model_ds], [metric])
In [7]:
eval.run()
results = eval.results
In [8]:
import ocw.plotter as plotter
outputName = "wrf_bias_compared_to_knmi"
config = {'gridshape': (4, 5),
'ptitle': 'TASMAX Bias of WRF Compared to KNMI (1989 - 2008)',
'subtitles': range(1989, 2009, 1)
}
plotter.draw_contour_map(results[0][0], lats, lons, outputName, 'png', **config)
plotFile = outputName + '.png'
print plotFile
In [9]:
from IPython.display import Image, display
display(Image(plotFile))
In [ ]: